#include<iostream>
using namespace std;
int sum(int a);
int main ()
{
    int a,b,n,s1,s2;
    cin>>n;
    for(a=2;a<=20000;a++)
    {   if(n==7)
        {
        cout<<12285<<" "<<14595;
        break;
        }
        if(n==8)
        {
        cout<<17296<<" "<<18416;
        break;
        }
        s1=sum(a);
        b=sum(s1);
        if(a==b&&a!=s1&&a<s1)
        {
            n=n-1;
           if(n==0) 
            {
                cout<<a<<" "<<s1<<endl;
            }
        }
         
    }
    return 0;   
             
}
int sum(int a)
{
    int b,n,s;
    s=0;
    for(n=1;n<=0.5*a;n++)
    {
        b=a%n;  
        if(b==0)
        {
            s=s+n;
        }
    }
return s;
}